package com.gezi.admin.module.config;

import com.gezi.admin.module.app.user.AppUserEntity;
import com.gezi.admin.module.app.user.AppUserService;
import com.gezi.admin.security.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Author 格子软件
 * @createDate 2024/2/10 09:00
 * @contact 公众号：格子软件 微信：13716343106 邮箱：1424529270@qq.com
 */
public abstract class BaseController{

    /**
     * UserService
     *
     * @return
     */
    @Autowired
    public AppUserService appUserService;

    /**
     * 获取用户id
     * @return
     */
    public String getUserId(){
        return SecurityUtil.getUserId();
    }

    /**
     * 获取UserEntity
     * @return
     */
    public AppUserEntity getUserEntity(){
        return appUserService.getById(getUserId());
    }

}
